#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long LL;
const int MAXN = 100007;
const int EPS = 1;
struct Point{
    LL a, b;
	LL c;
} point[MAXN];
LL C[MAXN];
LL Sum[MAXN];
int can[MAXN];
bool cmp(Point p1, Point p2) {
	return p1.c > p2.c;
}
LL n, l;
void solve() {
	int idx=1;
	LL cnt=0;
	for (int i=2; i<=n; ++i) {
        cnt = (cnt + point[i].c - C[idx]);
        if (cnt <= 0) break;
        ++idx;
	}
	can[1] = idx;
	for (int i=2; i<=n; ++i) {
		if (idx==n) {
			can[i] = idx;
			continue;
		}
        if (i-1>idx) {
            can[i] = idx;
            continue;
        }
//		if (i>idx) {
//			can[i] = idx;
//			continue;
//		}
		cnt = cnt + point[i-1].c - point[i].c;
		while (idx<n && cnt>0) {
			idx++;
			cnt += point[idx+1].c-C[idx];
		}
		can[i] = idx;
	}
}
bool judge(int ask) {
    --ask;
	for (int i=1; i<=n; ++i) {
        LL lim = l - point[i].a;
		if (can[i]<=ask) continue;
		if (i<=ask && Sum[ask+1]-point[i].c >= lim) return true;
		if (i>ask && Sum[ask] >= lim) return true;
	}
	return false;
}

int main() {
	#ifdef hai
	freopen("in.txt", "r", stdin);
	#endif
	while (cin>>n>>l) {
        LL cc=0;
		for (int i=1; i<=n; ++i) {
			scanf("%lld %lld", &point[i].a, &point[i].b);
            if (point[i].a>cc) cc=point[i].a;
			point[i].c = point[i].a - point[i].b;
		}
		for (int i=1; i<=n; ++i) {
			scanf("%lld", &C[i]);
		}
        if (cc>C[0] && cc>=l) {
            printf("1\n");
            continue;
        }
		sort(point+1, point+n+1, cmp);
        for (int i=1; i<=n; ++i) {
			Sum[i] = Sum[i-1] + point[i].c;
        }
        LL ff=n;
        for (int i=1; i<=n; ++i) {
            if (point[i].c<=0) {
                ff = i;
                break;
            }
        }
//        for (int i=1; i<=n; ++i) {
//            printf("i,a,b,c: %d %lld %lld %lld\n", i, point[i].a, point[i].b, point[i].c);
//        }
//        for (int i=1; i<=n; ++i) {
//            printf("i,sum: %d %lld\n", i, Sum[i]);
//        }
		solve();
//        for (int i=1; i<=n; ++i) {
//            printf("can[%d] : %d\n", i, can[i]);
//        }
		int le=1, ri=ff;
		while (le < ri) {
			int mid = (le+ri)/2;
			if (judge(mid)) ri=mid;
			else le=mid+1;
		}
        if (judge(ri)) printf("%lld\n", ri);
		else printf("-1\n");
	}
	return 0;
}
